/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.mzk.oai.repositoryManager;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author rehan
 */
public class JpaAccess {

    private static final String PERSISTENCE_UNIT_NAME="repositoryManagerPU";
    private static EntityManager em = null;

    public static EntityManager getEntityManager() {
        if (em == null) {
            EntityManagerFactory fact = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
            em = fact.createEntityManager();
        }
        return em;
    }
}
